package newmeeting;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

public class Appointment{
	
	private String title;
	private String date;
	private String timeStart;
	private String timeEnd;
	private Room room;
	private String description;
	public final static String titlePropertyComponent = "Title";
	public final static String datePropertyComponent = "Date";
	public final static String timeStartPropertyComponent = "TimeStart";
	public final static String timeEndPropertyComponent = "TimeEnd";
	public final static String roomPropertyComponent = "Room";
	public final static String descriptionPropertyComponent = "Description";

	private PropertyChangeSupport pcs;
	
	public Appointment(){
		pcs = new PropertyChangeSupport(this);
	}
	
	public Appointment(String title, String date, String timeStart, String timeEnd, Room room, String description) {
		pcs = new PropertyChangeSupport(this);
		this.title = title;
		this.date = date;
		this.timeStart = timeStart;
		this.timeEnd = timeEnd;
		this.room = room;
		this.description = description;
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		String oldValue = this.title;
		this.title = title;
		pcs.firePropertyChange(titlePropertyComponent, oldValue, title);
	}
	
	public String getDate() {
		return date;
	}
	
	public void setDate(String date) {
		String oldValue = this.date;
		this.date = date;
		pcs.firePropertyChange(datePropertyComponent, oldValue, date);
	}
	
	public Room getRoom() {
		return room;
	}
	
	public void setRoom(Room room) {
		Room oldValue = this.room;
		this.room = room;
		pcs.firePropertyChange(roomPropertyComponent, oldValue, room);
	}
	
	public String getTimeStart() {
		return timeStart;
	}
	
	public void setTimeStart(String timeStart) {
		String oldValue = this.timeStart;
		this.timeStart = timeStart;
		pcs.firePropertyChange(timeStartPropertyComponent, oldValue, timeStart);
	}
	
	public String getTimeEnd() {
		return timeEnd;
	}
	
	public void setTimeEnd(String timeEnd) {
		String oldValue = this.timeEnd;
		this.timeEnd = timeEnd;
		pcs.firePropertyChange(timeEndPropertyComponent, oldValue, timeEnd);
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		String oldValue = this.description;
		this.description = description;
		pcs.firePropertyChange(descriptionPropertyComponent, oldValue, description);
	}
	
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		pcs.addPropertyChangeListener(listener);
	}
	
	public void removePropertyChangeListener(PropertyChangeListener listener){
		pcs.removePropertyChangeListener(listener);
	}

	public void propertyChange(PropertyChangeEvent evt) {
	}
	
}